package com.shermanzhou.springbootflowable.demo.flow2;

import lombok.Data;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author zhouchaoqun02
 * @date 2020-07-11 15:56
 */
@Data
public class EngineApprovalFlowResult2 {
    private String rootFlowId;
    // 流程集合，包括子流程。key: flowId, value: 对应审批流实例
    private Map<String, EngineApprovalFlow> flowMap;

    public void addRootFlow(EngineApprovalFlow rootFlow) {
        rootFlowId = rootFlow.getFlowId();
        if (flowMap == null) {
            flowMap = new LinkedHashMap<>();
        }
        flowMap.put(rootFlowId, rootFlow);
    }

    public void addSubFlow(EngineApprovalFlow subFlow) {
        if (flowMap == null) {
            flowMap = new LinkedHashMap<>();
        }
        flowMap.put(subFlow.getFlowId(), subFlow);
    }
}
